<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"
    prefix="fmt" %>

<%@ taglib uri="http://www.dspace.org/dspace-tags.tld" prefix="dspace" %>

<%@ page import="javax.servlet.jsp.jstl.fmt.LocaleSupport" %>
<%@ page import="org.dspace.app.webui.util.UIUtil" %>
<%@ page import="org.dspace.core.ConfigurationManager" %>
<%@ page import="org.dspace.core.Context" %>
<%@ page import="org.dspace.content.Bitstream" %>
<%@ page import="org.dspace.app.webui.servlet.SubmissionController" %>
<%@ page import="org.col.dspace.tagger.submit.step.TagStep" %>
<%@ page import="org.dspace.submit.AbstractProcessingStep" %>
<%@ page import="org.dspace.app.util.SubmissionInfo" %>

<link href="<%=request.getContextPath() %>/submit-tag.css" rel=stylesheet  type="text/css" >
<script src="<%=request.getContextPath() %>/submit-tag.js" type="text/javascript" > </script>
<script>
	var contextPath="<%=request.getContextPath() %>";
</script>
<%
	request.setAttribute("LanguageSwitch", "hide");
	// Obtain DSpace context
	Context context = UIUtil.obtainContext(request); 
	Bitstream primaryBitstream = (Bitstream)request.getAttribute("primary-bitstream");
	//get submission information object
    SubmissionInfo subInfo = SubmissionController.getSubmissionInfo(context, request);
	String tags = (String)request.getAttribute("tags");

%>
<dspace:layout locbar="off"
               navbar="off"
               titlekey="jsp.submit.tag.title"
               nocache="true">
    <form id="submit-generate-tag-form" method="post" action="<%= request.getContextPath() %>/submit" onkeydown="return disableEnterKey(event);">
    	<jsp:include page="/submit/progressbar.jsp"/>
    	<%-- Hidden fields needed for SubmissionController servlet to know which step is next--%>
        <%= SubmissionController.getSubmissionParameters(context, request) %>
        
        <%-- <h1>Submit: Upload a File</h1> --%>
		<h1><fmt:message key="jsp.submit.tag.heading"/></h1>

		<p><fmt:message key="jsp.submit.tag.info1"/>
			<dspace:popup page="<%= LocaleSupport.getLocalizedMessage(pageContext, \"help.index\") + \"#upload\"%>"><fmt:message key="jsp.morehelp"/></dspace:popup></p>
        
        
        <table id="submit-tag-tb">
        	<colgroup>
        		<col class="col_name" />
        		<col class="col_size" />
        		<col class="col_format" />
        		<col class="col_tags" />
        		<col class="col_action" />
        	</colgroup>
        	<thead>
        		<tr>
        			<th>File Name</th>
        			<th>Size(Bytes)</th>
        			<th>Format</th>
        			<th>Tags</th>
        			<th>&nbsp;</th>
        		</tr>
        	</thead>
        	
        	<tbody>
        		<tr>
        			<td><%= primaryBitstream.getName()%></td>
        			<td><fmt:formatNumber><%= primaryBitstream.getSize() %></fmt:formatNumber></td>
        			<td><%= primaryBitstream.getFormatDescription() %></td>
        			<td class="tags_col"><%= tags %></td>
        			<td><input id="gen_tag_btn" type="submit" value="generate tags" name="<%=TagStep.SUBMIT_GENERATE_TAG_BUTTON %>" /></td>
        		</tr>
        	</tbody>
        	       
        </table>
        
        <input type="hidden" name="bitstream_id" value="<%= primaryBitstream.getID()%>" />
        
        <center>
            <table border="0" width="80%">
                <tr>
					<td width="100%">&nbsp;</td>
				<%  //if not first step, show "Previous" button
					if(!SubmissionController.isFirstStep(request, subInfo))
					{ %>
                    <td>
                        <input type="submit" name="<%=AbstractProcessingStep.PREVIOUS_BUTTON%>" value="<fmt:message key="jsp.submit.general.previous"/>" />
                    </td>
				<%  } %>
                    <td>
                        <input type="submit" name="<%=AbstractProcessingStep.NEXT_BUTTON%>" value="<fmt:message key="jsp.submit.general.next"/>" />
                    </td>
                    <td>&nbsp;&nbsp;&nbsp;</td>
                    <td align="right">
                        <input type="submit" name="<%=AbstractProcessingStep.CANCEL_BUTTON%>" value="<fmt:message key="jsp.submit.general.cancel-or-save.button"/>" />
                    </td>
                </tr>
            </table>
        </center>
    
    </form>           
                      
</dspace:layout>